//
//  BluetoothState.swift
//  RXSwiftDemo1
//
//  Created by mac on 2025/2/28.
//

import Foundation
import CoreBluetooth

public enum BluetoothState: Int {
    case unknown
    case resetting
    case unsupported
    case unauthorized
    case poweredOff
    case poweredOn
    
    init?(cbState: CBManagerState) {
            switch cbState {
            case .poweredOn:
                self = .poweredOn
            case .poweredOff:
                self = .poweredOff
            case .unauthorized:
                self = .unauthorized
            case .unsupported:
                self = .unsupported
            case .unknown:
                self = .unknown
            case .resetting:
                self = .resetting
            @unknown default:
                return nil
            }
        }
}
